package com.csweimei.rentmanagementtreasure.enterprise.viewModel;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableField;
import androidx.databinding.ObservableList;

import com.chad.library.BR;
import com.csweimei.rentmanagementtreasure.R;
import com.csweimei.rentmanagementtreasure.http.entity.HouseListEntBean;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.tatarka.bindingcollectionadapter2.ItemBinding;

public class HouseInfoEntP1VM extends MultiItemViewModel {
    public ObservableField<HouseListEntBean.DataDTO> bean = new ObservableField<>();

    public ObservableList<HouseInfoEntPVM> observableList = new ObservableArrayList<>();
    public ItemBinding<HouseInfoEntPVM> itemBinding = ItemBinding.of(BR.viewModel, R.layout.item_house_info_ent);

    public HouseInfoEntP1VM(@NonNull BaseViewModel viewModel, HouseListEntBean.DataDTO pBean) {
        super(viewModel);
        bean.set(pBean);
        observableList.clear();
        for (HouseListEntBean.DataDTO.HListDTO cBean:pBean.getHList()) {
            HouseInfoEntPVM houseInfoCVM = new HouseInfoEntPVM(viewModel,cBean);
            observableList.add(houseInfoCVM);
        }

    }
}
